import http from "@/utils/request"

export const register = async (nickname,email,passwd,code)=>{
    console.log("register");
    return await http.post('/user/register',{
        nickname,
        email,
        passwd,
        code
    })
}

export const login = async (email,passwd)=>{
    console.log("login");
    return await http.post('/user/login',{
        email,
        passwd
    })
}

export const sendVerifyCode = async (email)=>{
    console.log("sendVCode");
    return await http.post('/user/sendVerificationCode',{
        email
    })
}






export const wechatQrCode = async () => {
    console.log("wechatQrCode");
    return await http.get('/user/wechatQrCode')
}

export const wechatTryLogin = async (wechatOpenid) => {
    console.log("wechatTryLogin");
    return await http.post('/user/wechatTryLogin',{
        wechatOpenid
    });
}

export const wechatBindWithHasAccount = async (wechatOpenid,email,passwd) => {
    console.log("wechatBindWithHasAccount");
    return await http.post('/user/wechatBindWithHasAccount',{
        wechatOpenid,
        email,
        passwd
    });
}



export const query = async ()=>{
    console.log("query");
    return await http.get('/user/query',{
        
    })
}


export const editUserNickName = async (nickname)=>{
    console.log("editUserNickName");
    return await http.post('/user/editUserNickName',{
        nickname
    })
}

export const editUserPassword = async (password,newPassword)=>{
    console.log("editUserPassword");
    return await http.post('/user/editUserPassword',{
        password,
        newPassword
    })
}
